﻿namespace NEvoWeb.Modules.NB_Store
{
    using DotNetNuke.Entities.Portals;
    using DotNetNuke.Entities.Users;
    using Microsoft.VisualBasic;
    using System;
    using System.Web;

    public abstract class CalcCartInterface
    {
        private static CalcCartInterface objProvider = null;

        static CalcCartInterface()
        {
            CreateProvider();
        }

        private static void CreateProvider()
        {
            string storeSetting = SharedFunctions.GetStoreSetting(((PortalSettings) HttpContext.Current.Items["PortalSettings"]).PortalId, "calccart.provider");
            if (storeSetting != "")
            {
                string[] strArray = Strings.Split(storeSetting, ",", -1, CompareMethod.Binary);
                objProvider = (CalcCartInterface) Activator.CreateInstance(strArray[0], strArray[1]).Unwrap();
            }
        }

        public abstract CartTotals getCartTotals(int PortalID, string CartID);
        public abstract OptCodeInfo GetOptCodeInfo(int PortalID, string OptCode, UserInfo UserInfo, string TextOptions, string TextOptionsXML);
        public static CalcCartInterface Instance()
        {
            return objProvider;
        }
    }
}

